<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<html lang="en-us" xml:lang="en-us">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="DC.Type" content="topic">
  <meta name="DC.Title" content="Configuring Oracle Database Listening Parameters">
  <meta name="DC.Format" content="XHTML">
  <meta name="DC.Identifier" content="EN-US_TOPIC_0000001839188401">
  <meta name="DC.Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
  <title>Configuring Oracle Database Listening Parameters</title>
 </head>
 <body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px">
  <a name="EN-US_TOPIC_0000001839188401"></a><a name="EN-US_TOPIC_0000001839188401"></a>
  <h1 class="topictitle1">Configuring Oracle Database Listening Parameters</h1>
  <div>
   <p>To remotely access the Oracle database that is live mounted, you need to set the listening parameters of the database.</p>
   <div class="section">
    <h4 class="sectiontitle">Context</h4>
    <p>The listening IP address and port number of the database copy generated during live mount are the same as those of the source database corresponding to the copy. As a result, the database that is live mounted cannot be remotely accessed. Therefore, you need to configure the listening IP address and port number for the database that is live mounted.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Procedure</h4>
    <ol>
     <li id="EN-US_TOPIC_0000001839188401__li6675175142415"><span>Log in to the Oracle database host.</span><p></p>
      <ul id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ul1983714162204">
       <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li7258697580">If the Linux OS is used, use PuTTY to log in to the Oracle database host and run the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b119369483451">su - oracle</strong> command to switch to user <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b18221101415382">oracle</strong>.</li>
       <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li1366015032013">If the Windows OS is used, log in to the Oracle database host as the system administrator.</li>
      </ul> <p></p></li>
     <li><span>Run the following command to check the status of the database listener:</span><p></p><p><strong>lsnrctl status</strong></p>
      <ul>
       <li>If information similar to the following is displayed, the listener is in the listening state. In this case, go to <a href="#EN-US_TOPIC_0000001839188401__li56151443117">3</a>.<pre class="screen">[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 14-MAY-2021 04:33:58
Copyright (c) 1991, 2018, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date                14-MAY-2021 04:33:54
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully</pre></li>
       <li>If the listener is not in the listening state, run the <strong>lsnrctl start</strong> command to start the listener.</li>
      </ul> <p></p></li>
     <li id="EN-US_TOPIC_0000001839188401__li56151443117"><a name="EN-US_TOPIC_0000001839188401__li56151443117"></a><a name="li56151443117"></a><span>Run the following command to check the listening port:</span><p></p>
      <ul>
       <li>If the Linux OS is used, run the following command:<p><strong>cat $ORACLE_HOME/network/admin/listener.ora</strong></p>
        <ul>
         <li>If the command output shows that the <span class="uicontrol"><b>listener.ora</b></span> file does not exist in the directory, the default port number is <strong>1521</strong>.</li>
         <li>If information similar to the following is displayed, the value of <strong>PORT</strong> is the listening port to be queried:<pre class="screen">LISTENER =
#  (ADDRESS_LIST=
#       (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(<strong>PORT=1521</strong>))</pre></li>
        </ul></li>
       <li>If the Windows OS is used, perform the following operations:
        <ol type="a">
         <li>Press <span class="uicontrol" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_uicontrol11819941114510"><b>Win+R</b></span> to open the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b1015191219408">Run</strong> window.</li>
         <li>Enter <span class="parmvalue"><b>regedit</b></span> to open the registry and obtain the <strong>ORACLE_HOME</strong> path from <strong>Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDB</strong><em>19Home1</em>.
          <div class="note">
           <img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span>
           <div class="notebody">
            <p>In the path, <strong>KEY_OraDB</strong><em>19Home1</em> is only an example. Replace it based on actual conditions.</p>
           </div>
          </div></li>
         <li>Go to <strong>ORACLE_HOME</strong> and check whether the <span class="uicontrol"><b>listener.ora</b></span> file exists.
          <ul>
           <li>If no, the default port number is <strong>1521</strong>.</li>
           <li>If yes, the value of <strong>PORT</strong> in the file is the listening port to be queried.
            <div class="p">
             Example:
             <pre class="screen">LISTENER =
#  (ADDRESS_LIST=
#       (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(<strong>PORT=1521</strong>))</pre>
            </div></li>
          </ul></li>
        </ol></li>
      </ul> <p></p></li>
     <li><span>Run the following command to enable the firewall.</span><p></p>
      <ul>
       <li>If the Linux OS is used, run the following commands:<p><strong>su - root</strong></p> <p><strong>/sbin/iptables -I INPUT -p tcp --dport </strong><em>Port number</em><strong> -j ACCEPT</strong></p> <p><strong>iptables save</strong></p>
        <div class="note">
         <img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span>
         <div class="notebody">
          <p>In the command, <em>Port number</em> indicates the listening port number queried in <a href="#EN-US_TOPIC_0000001839188401__li56151443117">3</a>.</p>
         </div>
        </div></li>
       <li>If the Windows OS is used, perform the following operations:
        <ol type="a">
         <li>Open <strong>Control Panel</strong> and click <strong>System and Security</strong>.</li>
         <li>Choose <strong>Windows Defender Firewall</strong> &gt; <strong>Turn Windows Defender Firewall on or off</strong>.</li>
         <li>Select <strong>Turn off Windows Defender Firewall (not recommended)</strong> for both the private and public networks.</li>
         <li>Click <strong>OK</strong>.</li>
        </ol></li>
      </ul> <p></p></li>
     <li><span>Modify the database listening parameters.</span><p></p>
      <ol type="a">
       <li>Run the following commands to log in to the Oracle database instance.
        <ul id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ul7420345341">
         <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li15682124913711">OS authentication:
          <ul id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ul89443983816">
           <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li18420124173415">If the Linux OS is used, run the following commands:<p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p95148598366"><a name="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li18420124173415"></a><a name="en-us_topic_0000001839188333_li18420124173415"></a><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b14236563719">export ORACLE_SID=</strong><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i85144598369">Database instance name</em></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p145141259153613"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b1597618293715">sqlplus / as sysdba</strong></p></li>
           <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li7402151163816">If the Windows OS is used, perform the following operations:
            <ol class="substepthirdol" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ol124110408264">
             <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li624120402267">Press <span class="uicontrol" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_en-us_topic_0000001839188333_uicontrol11819941114510"><b>Win+R</b></span> to open the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_en-us_topic_0000001839188333_b1015191219408">Run</strong> window.</li>
             <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li161821338277">Enter <span class="parmvalue" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_parmvalue122291222476"><b>cmd</b></span> and run the following commands:<p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p1755152313372"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b19591532143713">set ORACLE_SID=</strong><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i16755423133718">Database instance name</em></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p1075515234379"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b540852910371">sqlplus / as sysdba</strong></p></li>
            </ol></li>
          </ul></li>
         <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li105571236103417">Database authentication:
          <ul id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ul1136516538386">
           <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li1723334817382">If the Linux OS is used, run the following commands:<p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p920984963717"><a name="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li1723334817382"></a><a name="en-us_topic_0000001839188333_li1723334817382"></a><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b162511338427">export ORACLE_SID=</strong><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i142521037423">Database instance name</em></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p182093496371"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b034785743716">sqlplus</strong></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p17915722412">Enter the name of a user with the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b0440649114212">sysdba</strong> permissions as prompted:</p> <pre class="screen" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_screen9915112104114"><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i1915102164113">username </em>as sysdba</pre> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p159150224117">Enter the password as prompted.</p></li>
           <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li122822426407">If the Windows OS is used, perform the following operations:
            <ol class="substepthirdol" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_ol587720252273">
             <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li5168124414479">Press <span class="uicontrol" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_en-us_topic_0000001839188333_uicontrol11819941114510_1"><b>Win+R</b></span> to open the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_en-us_topic_0000001839188333_b1015191219408_1">Run</strong> window.</li>
             <li id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_li3877172517270">Enter <span class="parmvalue" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_parmvalue89061315114212"><b>cmd</b></span> and run the following commands:<p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p8745723103813"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b0361183517422">set ORACLE_SID=</strong><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i8361163518426">Database instance name</em></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p15745182333814"><strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b11154427163811">sqlplus</strong></p> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p71274192512">Enter the name of a user with the <strong id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_b330420012221">sysdba</strong> permissions as prompted:</p> <pre class="screen" id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_screen18896121620243"><em id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_i380114413256">username </em>as sysdba</pre> <p id="EN-US_TOPIC_0000001839188401__en-us_topic_0000001839188333_p15251105852511">Enter the password as prompted.</p></li>
            </ol></li>
          </ul></li>
        </ul></li>
       <li>Run the following command to change the listening IP address and port number of the database:<p><strong>alter system set local_listener="(address = (protocol = tcp)(host =</strong><em>IP address of the current database host</em><strong>)(port = </strong><em>Queried port number</em><strong>))";</strong></p></li>
       <li>Run the following command to check whether the listening parameters are successfully modified:<p><strong>show parameter local_listener;</strong></p>
        <div class="p">
         Information similar to the following is displayed. If the values of <strong>host</strong> and <strong>port</strong> are changed, the modification is successful.
         <pre class="screen">SQL&gt;  show parameter local_listener;

NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
local_listener                       string
(address = (protocol = tcp)(host = 192.168.97.161)(port = 1521))</pre>
        </div></li>
      </ol> <p></p></li>
    </ol>
   </div>
  </div>
 </body>
</html>